home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / August 96 / Re sending AEevents from conta < prev    next >
Encoding:
Internet Message Format  |  1996-08-07  |  1.2 KB  |  [TEXT/ttxt]

  1. Subject:     Re: sending AEevents from container to embedded parts
  2. Sent:        8/6/96 7:21 PM
  3. Received:    8/7/96 8:55 AM
  4. From:        lamiraux@ix.netcom.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. >  ODPart*         embeddedPart = proxy->AcquireEmbeddedPart(ev);
  9.  
  10. Something that has nothing to do with your problem but is still a 
  11. problem in the code you sent: when calling method starting with 
  12. "Acquire" you MUST release the returned object:
  13.  
  14.      ODPart*         embeddedPart = proxy->AcquireEmbeddedPart(ev);
  15.      
  16.      <Some code here>
  17.      
  18.       embeddedPart->Release(ev);
  19.  
  20.  
  21. If you don't do that you will refcounting errors. The code above should 
  22. be in fact be written
  23.  
  24.      FW_AcquiredODPart        embeddedPart = proxy->AcquireEmbeddedPart(ev);
  25.      
  26.      <Some code here>
  27.  
  28. This allows you to have the <Some code here> throwing an exception and 
  29. still have embeddedPart being released correctly. This way you don't 
  30. need a try block.
  31.  
  32. Refcounting is very important in OpenDoc. Not paying attention to it 
  33. will result in very poorly functionning part. ODF provides some tools 
  34. (like the FW_CAcquiredODxxx classes) but cannot prevent developers from 
  35. making mistakes.
  36.